<!-- 详情描述组件 -->
<template>
  <div class="info" :key="key">
    <div v-if="Boolean(title)" class="title">{{ title }}</div>
    <el-row v-bind="rowProp">
      <slot>
        <div class="empty">暂无数据</div>
      </slot>
    </el-row>
  </div>
</template>

<script>
export default {
  name: "el-info",
  props: {
    title: {
      type: String,
      required: false,
      default: ""
    },
    data: {
      type: Object,
      required: true
    },
    rowProp: {
      type: Object,
      default: () => ({ gutter: 16 })
    },
    colProp: {
      type: Object,
      default: () => ({})
    }
  },
  data() {
    return {
      key: false
    };
  },
  watch: {
    data: {
      handler() {
        this.key = !this.key;
      },
      deep: true
    }
  }
};
</script>

<style lang="scss" scoped>
.info {
  .title {
    font-weight: 700;
    font-size: 16px;
    line-height: 1.5;
    margin-bottom: 20px;
    color: rgba(0, 0, 0, 0.85);
  }
  .empty {
    text-align: center;
    color: grey;
  }
}
</style>
